<script>
if (timer!=null)
	clearInterval(timer);

$(document).ready(function(){
	$('#cancel').click(function() { 
		$.unblockUI(); 
		return false; 
		}); 
	});

var player;

function messageToPlayer(destplayer)
	{ 
	var player;
	if (destplayer=="")
	{
		player="all";
		$('#player').val('');
	}
	else
	{
		$('#player').val(destplayer);
		player=destplayer;
	}
	$.blockUI({
		theme: true,
		css:{ 
			padding:        0, 
			margin:         0, 
			width:          '350px'
			},
		title:    '<?php __("Send message to ",true);?> '+player,
		fadeIn:  300,
		message: $('#chatmsg')});
	};
</script>
<div class="panel">
<div id="statuspanel">
<div class="titlepanel"><?php __('Status');?></div>
<div id="status_bar" class="ui-widget-content contentpanel" style="height:83px">
<?php
if ($useRemoteToolkit)
	echo $this->element("remotecommand");
if ($useTcpBukkit)
	echo $this->element("serverstatus");
if (!empty($pid))
	echo $this->element("pid");
if (!empty($cpu_usage) && !empty($mem_usage))
	echo $this->element("sys_usage");
?>
</div>
</div>
<div id="playerpanel">
<div class="opaque">
<?php if ($useTcpBukkit) echo $this->element("playerpanel"); ?>
</div>
</div>
<!-- Chat message form -->
<div id="chatmsg" style="display:none" class="dialog">
<?php
echo $form->create(null);
echo $form->input('player',array('id'=>'player','type'=>'hidden'));
echo $form->input('message',array('id'=>'message','div'=>FALSE));
?>
<center>
<?php
echo $form->submit('Send',array('div'=>false,'type'=>'submit','id'=>'sendMessage'));
?>
<input type="reset" value="cancel" onclick="$.unblockUI();">
</center>
<?php
$this->Js->get('#sendMessage');
$this->Js->event('click',
$this->Js->request(
array('controller' => 'private','action'=>'pm_player'),
array(
'type'=>'json',
'method'=>'post',
'data'=> '{player:$("#player").val(),msg:$("#message").val()}',
'dataExpression' => true,
'complete' => '$.unblockUI();',
'success'=>'$.blockUI({ message:"<h1>'.__('Send succeed...',true).'</h1>"});',
'error'=>'alert("An unexpected error has occurred!");'							
	)));
?>
</div>
<!-- End of chat form -->
</div>
<?php echo $this->Js->writeBuffer(); ?>
